package com.king.pattem.future;

/**
 * @author taomk
 * @version 1.0
 * @since 15-1-30 下午10:14
 */
public class Client {

	public Data request(final String queryStr) {
		final FutureData future = new FutureData();

		// RealData的构建很慢，所以在单独的线程中进行
		new Thread() {
			public void run() {
				RealData realData = new RealData(queryStr);
				future.setRealData(realData);
			}
		}.start();

		// FutureData会被立即返回
		return future;
	}
}
